<?php
$id = $this->uri->segment(4,0);
$q = $this->db->query("select id_subject from subject where name='$id' limit 1");
foreach ($q->result() as $re):
		$id = $re->id_subject;
endforeach;
?>
<script type="text/javascript">
function save(form, evt){
	new Event(evt).stop();
	form = $(form);
	form.set('send', {url:'<?php echo base_url()?>dash/ajax_radio_save', method:'post',
			 	onSuccess: function(responseText, responseXML){
					//box_message('Add Question','Data has been save');
					res();
					setfocus();
				},
				onComplete: function(){
					
				},
				onFailure: function(xhr){
					alert('failure');
				}
			});
		form.send();
	return false;
}

function setfocus(){
	$('question').focus();
}
function res(){
	$('a').set('value','');
	$('b').set('value','');
	$('c').set('value','');
	$('d').set('value','');
	$('e').set('value','');
//	$('opt').set('checked','unchecked');
//	$('question').set('html','');
//	$('textarea').set('html','oke');
}

window.addEvent('load', function(){
		
		$('question').mooEditable({
		actions: 'bold italic underline strikethrough | formatBlock justifyleft justifyright justifycenter justifyfull | insertunorderedlist insertorderedlist indent outdent insertHorizontalRule | undo redo removeformat | createlink unlink | urlimage | toggleview'
		});
		
	//setFocus();
        new FormCheck('fomrque', {
		display : {
			errorsLocation : 1,
			showErrors : 1,
			addClassErrorToField : 1
		}
	})
});

</script>
<style type="text/css">
	#question{
		width: 88%;
		height: 150px;
		padding: 10px;
		border: 2px solid #ddd;
	}
</style>
<table width="98%" height="500" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td class="table-box bg-trans" valign="top">
    
<div class="margin padding">
<table width="99%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="left" class="font-size-16 bold"><?php echo $this->uri->segment(4,0)?></td>
    <td align="right"><span class="margin-right-10"><a href="javascript:history.go(-1)" class="uiButtonRounded bold font-size-11">back</a></span></td>
  </tr>
</table>
<hr size="1" color="#999999" width="98%" align="left" /><br />

<form name="fomrque" id="formque" method="post" action="" enctype="multipart/form-data" onSubmit="save(this, event)" >
  <table width="100%" border="0" cellspacing="2" cellpadding="3">
    <tr>
      <td width="70" align="right" valign="top">Question</td>
      <td>
        <textarea name="question" id="question" cols="90" rows="6" class="validate['required']"></textarea>
        <input name="id_subject" type="hidden" id="id_subject" value="<?php echo $id ?>" /></td>
    </tr>
    <tr>
      <td align="right" valign="middle">A</td>
      <td><input type="text" name="a" id="a" class="text-lightface validate['required']">
        <input type="radio" name="opt" id="opt" value="a" class="validate['required']"></td>
    </tr>
    <tr>
      <td align="right" valign="middle">B</td>
      <td><input type="text" name="b" id="b" class="text-lightface validate['required']">
        <input type="radio" name="opt" id="opt" value="b" class="validate['required']"></td>
    </tr>
    <tr>
      <td align="right" valign="middle">C</td>
      <td><input type="text" name="c" id="c" class="text-lightface validate['required']">
        <input type="radio" name="opt" id="opt" value="c" class="validate['required']"></td>
    </tr>
    <tr>
      <td align="right" valign="middle">D</td>
      <td><input type="text" name="d" id="d" class="text-lightface validate['required']">
        <input type="radio" name="opt" id="opt" value="d" class="validate['required']"></td>
    </tr>
    <tr>
      <td align="right" valign="middle">E</td>
      <td><input type="text" name="e" id="e" class="text-lightface validate['required']">
        <input type="radio" name="opt" id="opt" value="e" class="validate['required']"></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td align="right" class="padding-right-30">
      <div class="padding-right-20 margin-right-20">
        <input type="reset" name="button2" id="button2" value="Reset" class="uiButtonRounded">
        <input type="submit" name="button" id="button" value="Save" class="uiButtonRounded">
        
      </div>
      </td>
    </tr>
  </table>
</form>
</div>

	</td>
  </tr>
</table>